import { Component } from '@angular/core';
import { Platform,ToastController} from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';


import { TabsPage } from '../pages/tabs/tabs';
import { WelcomePage } from '../pages/welcome/welcome';
@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  // rootPage:any = TabsPage;
  rootPage:any;
  public static backButtonPressedOnceToExit = false;


  constructor(
    platform: Platform,
    statusBar: StatusBar,
    splashScreen: SplashScreen,
    public toastCtrl:ToastController) {

    // 如果用户是第一次启动，就跳转到欢迎界面。不是就直接进入首页
    let result = localStorage.getItem('firstIn');
    if(result){
      this.rootPage = TabsPage;
    }else{
      localStorage.setItem('firstIn', "yes");
      this.rootPage = WelcomePage;
    }

    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      splashScreen.hide();
    });
  }
}
